<?php

namespace App\Modules\Apicrzs\Services\System;

use App\Library\OSS\AliyunOssService;
use App\Models\UploadFile;

use App\Modules\Apicrzs\Services\BaseServices;
use App\Traits\CryptAES;

class UploadOssService extends BaseServices
{
    public function __construct(UploadFile $banner)
    {
        $this->model = $banner;
        $token =  \request()->header('token');
        $user_info = CryptAES::decryptToken($token,'user_grzq');
        $this->user_id = $user_info['data']['user_id']??"";
    }

    public function UploadFileSign($perams)
    {
        $path = $perams['path']??$this->user_id;
        $dirs = $perams['dir']??"sys";
        $dir =  "upload/".$dirs.'/'.$path.'/'.date('Ymd')."/";
        $res = AliyunOssService::AliyunOssSign($dir);

        return $res;
    }
}
